package libs.yzx.zaza.acts2;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import libs.yzx.zaza.R;

/**
 * Created by Administrator on 2016/9/27
 */
public class WebViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_webview);
        ViewGroup vg =  (ViewGroup)findViewById(R.id.container);
        vg.addView(getWebView());
    }


    private WebView getWebView(){
        WebView wv = new WebView(this);
        wv.setWebViewClient(new WebViewClient(){
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return false;
            }
        });
        wv.getSettings().setJavaScriptEnabled(true);
        wv.loadUrl("http://www.baidu.com");
        return wv;
    }

}
